# NOTE: only 1 of this reducer should exist

import sys

def main():
    '''
    output: ebv_init_count.txt
    (key, value..) -> (key, sum-of-values)
    '''
    prev_key = ''
    tot = 0
    for line in sys.stdin:
        key, val = line.split()
        val = int(val)
        if key == prev_key:
            tot += val
        else:
            if prev_key:
                print '%s\t%d' % (prev_key, tot)
            tot = val
        prev_key = key
    if tot:
        print '%s\t%d' % (prev_key, tot)

if __name__ == '__main__':
    main()

